
usingNamespace("Biz.Common")["Validation"] = { textCount: function (D, A, B) { var C = $(D).val(); if ($(D).val().length > B) { $(D).val(C.substring(0, B)) } },
    refreshValidator: function (B, A) { $(B).attr("src", $(B).attr("src") + "&r=" + Math.random()); $(A).focus() },
    isUrl: function (A) {
        var B = /^((http(s)?|ftp|telnet|news|rtsp|mms):\/\/)?(((\w(\-*\w)*\.)+[a-zA-Z]{2,4})|(((1\d\d|2([0-4]\d|5[0-5])|[1-9]\d|\d).){3}(1\d\d|2([0-4]\d|5[0-5])|[1-9]\d|\d).?))(:\d{0,5})?(\/+.*)*$/;
        return B.test(A)
    }, isDecimal: function (B) { var A = /^(([1-9]\d{0,12})|0)(\.\d{1,2})?$/; return A.test(B) },
    isEmail: function (A) { var B = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/; return B.test(A) }, isLowEmail: function (B) {
        var A, C; A = B.indexOf("@"); C = B.indexOf("."); if (A <= 0) { return false } if (C < 0 || C == (B.length - 1)) { return false } return true
    },
    clearNoNum: function (A, B) {
        A = window.event || A; if (A.keyCode == 37 | A.keyCode == 39) { return } B.value = B.value.replace(/[^\d.]/g, "");
        B.value = B.value.replace(/^\./g, ""); B.value = B.value.replace(/\.{2,}/g, "."); B.value = B.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".")
    },
    checkNum: function (A) { A.value = A.value.replace(/\.$/g, "") }, isInteger: function (A) { var B = new RegExp(/^\d+$/); return B.test(A) },
    isValidateReg: function (B) { var A = /^([A-Za-z0-9\s\-\_\~\!\@\#\$\%\^\&\*\(\)\|\<\>\?\:\;\"\'\.\[\]\{\}\,\+\`\/\\\=]){6,16}$/; if (A.test(B)) { return true } return false },
    isDate: function (H) {
        var C = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/; if (!C.test(H)) { return false } else {
            var F = H.split(RegExp.$1); var G = parseInt(F[2], 10);
            var D = parseInt(F[0], 10); var E = parseInt(F[1], 10); if (E > 12 || E < 1) { return false } var B = { "1": 31, "3": 31, "4": 30, "5": 31, "6": 30, "7": 31, "8": 31, "9": 30, "10": 31, "11": 30, "12": 31 };
            if (B[parseInt(F[1])] != null) { if (G <= B[parseInt(F[1])] && G != 0) { return true } } if (E - 2 == 0) {
                var A = (D % 4 == 0 && (D % 100 != 0 || D % 400 == 0)); if (((A && G <= 29) || (!A && G <= 28)) && G != 0) { return true } 
            } 
        } return false
    },
    isZip: function (B) { var A = /^[0-9]{6}$/; return A.test(B) }, checkSpecialChar: function (B) { var A = /([~!@#$%^&*\/\\,.\(\)]){6,16}$/; return A.test(B) },
    CheckSpecialString: function (B) { var A = /[\u0000-\u0008\u000B\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/; return A.test(B) },
    isTel: function (B) { var A = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/; if (!A.exec(B)) { return false } return true }, isMobile: function (B) {
        var A = /^1\d{10}$/;
        return A.test(B)
    }, getLength: function (A) { return A.replace(/[^\x00-\xff]/g, "**").length },
    isLicence: function (B) { var A = /^[A-Za-z]{10}[0-9]{10}$/; return A.test(B) },
    isPersonalCard: function (B) { var A = /(^\d{15}$)|(^\d{17}(\d|[A-Za-z]{1})$)/; return A.test(B) }, isOrganizationCodeCard: function (B) {
        var A = /^[A-Za-z0-9]{9}$/;
        return A.test(B)
    }, isBankAccount: function (B) { var A = /^[1-9]{1}[0-9]*$/; return A.test(B) },
    MaxLength: function (F, E) {
        var A = F.value.replace(/[^\x00-\xff]/g, "**").length;
        var D = F.value; var C = ""; if (A > E) {
            for (var B = 0; B < E; B++) { if (C.replace(/[^\x00-\xff]/g, "**").length < E) { C = D.substr(0, B + 1) } else { break } }
            if (C.replace(/[^\x00-\xff]/g, "**").length > E) { C = C.substr(0, C.length - 1); F.value = C } else { F.value = C } 
        } 
    } 
};
usingNamespace("Biz.Common")["ValidateHelper"] = { normalMessage: function (A, E) {
    var B = $(A.parent().find("em")[0]);
    var D = B.find("span")[0]; if (D != null) { var C = $Resource.BuildContent(E); B.empty().append(C); B.css("margin-top", "2px") } 
},
normalMessageForShippingAddress: function (A, D) {
    var B = $(A.parent().find("em")[0]); if (B != null) {
        var C = $Resource.BuildContent(D);
        B.empty().append(C)
    } 
}, normalMessageForCheckOut: function (A, E) {
    var B = $(A.parent().find("em")[0]); var D = B.find("span")[0]; if (D != null) {
        var C = $Resource.BuildContent(E); B.empty().append(C)
    } 
}, warningMessageForPersonalInfo: function (A, F) {
    if (A[0] == null) { return false }
    var D = $(A.parent().find("em")[0]); var E = $Resource.BuildContent(F);
    var B = Biz.Common.Validation.getLength(E) * 6; var C = "<span style='background:transparent url(" + $Resource.BuildImage("icon/iconA3_1.gif") + ") no-repeat scroll 10px -1938px;color:#FF4C31;float:left;width:" + B + "px;height:23px;line-height:23px;padding:0 10px 0 35px;margin-top:0px'>" + E + "</span>";
    D.empty().append(C); D.css("margin-top", "0px")
}, warningMessageForDay: function (A, E) {
    if (A[0] == null) { return false } var C = $(A.parent().find("em")[0]);
    var D = $Resource.BuildContent(E); var B = "<span style='background:transparent url(" + $Resource.BuildImage("icon/iconA3_1.gif") + ") no-repeat scroll 10px -1938px;color:#FF4C31;float:left;width:270px;height:23px;line-height:23px;padding:0 10px 0 35px;margin-top:0px'>" + D + "</span>";
    C.empty().append(B); C.css("margin-top", "0px")
}, warningMessage: function (A, E) {
    if (A[0] == null) { return false } var C = $(A.parent().find("em")[0]); var D = $Resource.BuildContent(E);
    var B = "<span style='background:transparent url(" + $Resource.BuildImage("icon/iconA3_1.gif") + ") no-repeat scroll 12px -1938px;color:#FF4C31;float:left;height:23px;line-height:23px;padding:0 10px 0 35px;font-weight:lighter;width:140px'>" + D + "</span>";
    C.empty().append(B); C.css("margin-top", "1px")
}, areaWarningMessage: function (A, E) {
    var D = $(A.parent().find("em")[0]); D.empty(); D.hide();
    var B = $(A.parent().find("#region")[0]); var C = $(A.parent().find("#city")[0]);
    if (B.val() == "-1") { Biz.Common.ValidateHelper.areaShowWarningMessage(D, B, "AccountCenter_ModifyShippingAddress_ProvinceError") }
    else {
        if (C.val() == "-1") { Biz.Common.ValidateHelper.areaShowWarningMessage(D, C, "AccountCenter_ModifyShippingAddress_CityError") }
        else { if (A.val() == "-1") { Biz.Common.ValidateHelper.areaShowWarningMessage(D, A, E) } } 
    } 
}, areaShowWarningMessage: function (C, A, E) {
    if (A.val() == "-1") {
        var D = $Resource.BuildContent(E);
        var B = "<span style='background:transparent url(" + $Resource.BuildImage("icon/iconA3_1.gif") + ") no-repeat scroll 12px -1938px;color:#FF4C31;float:left;width:60px;height:23px;line-height:23px;padding:0 10px 0 35px;margin-top:0px;font-weight:lighter'>" + D + "</span>";
        C.empty().append(B); C.css("margin-top", "0px"); C.show()
    }
    else { C.empty(); C.hide() } 
},
warningMessageForShippingAddress: function (A, E) {
    Biz.Common.ValidateHelper.clearMessage(A);
    if ($String.IsNullOrEmpty($.trim(A.val()))) {
        var C = $(A.parent().find("em")[0]); 
        var D = $Resource.BuildContent(E);
        var B = "<span style='background:transparent url(" + $Resource.BuildImage("icon/iconA3_1.gif") + ") no-repeat scroll 12px -1938px;color:#FF4C31;float:left;height:23px;line-height:23px;padding:0 10px 0 35px;'>" + D + "</span>"; C.empty().append(B); C.css("margin-top", "1px")
    } 
},
warningMessageInclueReplace: function (B, F, A) {
    var D = $(B.parent().find("em")[0]); var E = $Resource.BuildContent(F); E = E.replace("{0}", A);
    var C = "<span style='background:transparent url(" + $Resource.BuildImage("icon/iconA3_1.gif") + ") no-repeat scroll 12px -1938px;color:#FF4C31;float:left;height:23px;line-height:23px;padding:0 10px 0 35px;'>" + E + "</span>";
    D.empty().append(C); D.css("margin-top", "1px")
}, clearMessage: function (A) { var B = $(A.parent().find("em")[0]); B.empty() },
clearMessageForShippingAddress: function (A, B) {
    var C = $(A.parent().find("em")[0]); C.empty();
    Biz.Common.ValidateHelper.normalMessageForShippingAddress($(A), B)
},
validateStringValue: function (D, B, C) {
    var A = $(D); Biz.Common.ValidateHelper.clearMessage(D);
    if ($String.IsNullOrEmpty($.trim(A.val()))) { Biz.Common.ValidateHelper.warningMessage(A, C) }
    else { Biz.Common.ValidateHelper.normalMessage(A, B) } 
},
validateStringValueForShippingAddress: function (D, B, C) {
    var A = $(D); Biz.Common.ValidateHelper.clearMessage(D);
    if ($String.IsNullOrEmpty($.trim(A.val()))) { Biz.Common.ValidateHelper.warningMessageForPersonalInfo(A, C); return false }
    else {
        if ($.trim(A.val()).length > 20 && (B == "AccountCenter_ModifyShippingAddress_ReceiveNameDesc" || B == "AccountCenter_ModifyShippingAddress_ReceiveContactDesc")) {
            Biz.Common.ValidateHelper.warningMessageForPersonalInfo(A, "AccountCenter_ModifyShippingAddress_InfoMaxLength"); return false
        }
        else { Biz.Common.ValidateHelper.normalMessageForShippingAddress(A, B); return true } 
    } 
},
validateStringValueForCellPhone: function (D, B, C, E) {
    var A = $(D); Biz.Common.ValidateHelper.clearMessageForShippingAddress(D, B);
    if (E == "yes") { Biz.Common.ValidateHelper.warningMessageForPersonalInfo(A, C); return } if ($.trim(A.val()) != "") {
        if (!Biz.Common.Validation.isMobile($.trim(A.val()))) { Biz.Common.ValidateHelper.warningMessageForPersonalInfo(A, C) } 
    }
    else { Biz.Common.ValidateHelper.normalMessage(A, B) } 
},
validateStringValueForZip: function (C, B) {
    var A = $(C); Biz.Common.ValidateHelper.clearMessage(C);
    if (!$String.IsNullOrEmpty($.trim(A.val()))) { if (!Biz.Common.Validation.isZip(A.val())) { Biz.Common.ValidateHelper.warningMessageForPersonalInfo(A, B) } }
    else { Biz.Common.ValidateHelper.warningMessageForPersonalInfo(A, "AccountCenter_PersonalInfo_ZipEmpty") } 
},
validationSystemAddressArea: function (E, B) {
    var A = $(E); var D = parseInt(A.val()); if (D <= 0) { Biz.Common.ValidateHelper.warningMessage(A, B) }
    else {
        var C = $(A.parent().find("em")[0]); var F = C.find("strong span")[0]; if (F != null) { C.empty().append("<strong>*</strong>"); C.css("margin-top", "2px") }
        else { F = C.find("span")[0]; if (F != null) { C.empty().append("*"); C.css("margin-top", "8px") } } 
    } 
}
};
usingNamespace("Biz.Common")["Loading"] = { showForRemoveElement:
function (B) {
    if (B[0] != null) {
        var A = $Resource.BuildContent("PopupInfo"); B.after('<p id="divLoading" class="process" style="width:150px" ><span>' + A + "</span></p>");
        B.hide()
    }
}, showChangeSOElement: function (B) {
    if (B[0] != null) {
        var A = $Resource.BuildContent("PopupInfo"); B.after('<p id="divLoading" class="process" style="width:150px;position: absolute;margin:0 10px;" ><span>' + A + "</span></p>");
        B.hide()
    }
}, removeLoadingForShowElement: function (A) {
    if (A[0] != null) {
        var B = A.parent().find("#divLoading");
        if (B[0] != null) { B.remove() } A.show()
    }
}, show: function (C) {
    if (C[0] != null) {
        var B = $Resource.BuildContent("PopupInfo");
        var G = C.offset().left; var F = C.offset().top; var D = C.width(); var A = C.height(); G += D + 20; F += A / 2 - 24;
        var E = $('<p id="divLoading" class="process" style="position: absolute;width:150px;height:14px"><span>' + B + "</span></p>"); E.css("zindex", 100);
        E.css("left", G.toString() + "px"); E.css("top", F.toString() + "px"); C.append(E)
    }
}, showAreaCenter: function (C) {
    if (C[0] != null) {
        var G = C.offset().left; var F = C.offset().top; var B = $Resource.BuildContent("PopupInfo"); var D = C.width();
        var A = C.height(); G += D / 2 - 75; F += A / 2 - 20; var E = $('<p id="divLoading" class="process" style="position: absolute;width:150px"><span>' + B + "</span></p>");
        E.css("zindex", 100); E.css("left", G.toString() + "px"); E.css("top", F.toString() + "px"); C.append(E)
    }
},
    showAreaCenterForCheckOut: function (C) {
        if (C[0] != null) {
            var G = C.offset().left; var F = C.offset().top;
            var B = $Resource.BuildContent("PopupInfo"); var D = C.width();
            var A = C.height(); G += D / 2 - 75; F += A / 2 - 28; var E = $('<p id="divLoading" class="process" style="position: absolute;width:150px"><span>' + B + "</span></p>");
            E.css("zindex", 100); E.css("left", G.toString() + "px"); E.css("top", F.toString() + "px"); C.append(E)
        }
    },
    removeLoading: function (A) { if (A[0] != null) { var B = A.find("#divLoading"); if (B[0] != null) { B.remove() } } },
    showLoadingForPersonalInfo: function (B) {
        if (B[0] != null) {
            var A = $Resource.BuildContent("PopupInfo");
            var C = $('<p id="divLoading" style="background:#FFFEE2 none repeat scroll 0 0;margin:0px auto 0 310px;border:1px solid #FFB903;padding:8px 12px;list-style-image:none;list-style-position:outside;list-style-type:none;width:150px;height:4px;" ><span style="text-align:center; margin-top:-6px;padding-left:23px;color:#FF6600;background:transparent url(' + $Resource.BuildImage("icon/iconE.gif") + ') no-repeat scroll center left;">' + A + "</span></p>"); B.before(C); B.hide()
        }
    }
};